package com.oyo.common.enums;

/**
 * @Desc: 支付方式类型
 * @Author: sangbowei
 * @Description:
 * @Date: 2018/8/27 19:36
 */
public enum PaymentType {

	CASH(1,"现金"),
	WECHAT(2,"微信"),
	ALIPAY(3,"支付宝"),
	BANK_CARD(4,"银行卡"),
	HANGING_ACCOUNTS(5,"挂账"),
	XIAOMI_POS_ALIPAY(6,"小米POS-支付宝"),
	XIAOMI_POS_WECHAT(7,"小米POS-微信"),
	XIAOMI_POS_AGGREGATE(8,"小米POS-聚合支付"),
	XIAOMI_POS_BANK_CARD(9,"小米POS-银行卡"),
	CTRP(10,"携程"),
	MEITUAN(11,"美团"),
	ELONG(12,"艺龙"),
	QUNAR(13,"去哪儿"),
	FLIGGY(14,"飞猪");

	int code;
	String name;

	PaymentType(int code, String name) {
		this.code = code;
		this.name = name;
	}

	public static String getNameByCode(int code) {
		PaymentType[] types = values();
		for (PaymentType type : types) {
			if (type.getCode() == code) {
				return type.getName();
			}
		}
		return null;
	}

	public int getCode() {
		return code;
	}

	public String getName() {
		return name;
	}
}
